import basepath
import os
from common.base import j_load
from common.mysql import replace_mysql

from common.mysql_config import BJ_CONFIG

class confing(BJ_CONFIG):
    db = 'hospital'

tname = 'ylfwtz'
fname = 'ylfwtz.txt'
fname = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'ylfwtz.txt')
print(fname)
datas = j_load(fname)
KS_CHOIES = [
        (1, '综合住院'),
        (2, '综合门诊'),
        (3, '化验室'),
        (4, 'B超室'),
        (5, '手术室'),
        (6, '中医理疗'),
        (7, '药房'),
        (8, '转移联单')
    ]

zh_dic = {key:value for value,key in KS_CHOIES}
datas = [{key:zh_dic.get(value,value) for key,value in data.items()} for data in datas]
# print(datas)
replace_mysql(tname,datas,confing)
